Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

307
Vistas
Apache: "Virtualhost not allowed here" error when using If condition

I have a condition inside httpd.conf that looks like this:

<If "-f '/some/path/to/existing/file'">
   <VirtualHost _default:$port1>
     ServerName example.com

     ...config1...
   </VirtualHost>
</If>
</Else>
   <VirtualHost _default:$port1>
     ServerName example.com

     ...config2...
   </VirtualHost
</Else>

However, it's giving me a syntax error AH00526 that says "VirtualHost not allowed here". If I comment out the "If Else" condition, and put a VirtualHost outside the block, it works.

How could I fix this while keeping the condition?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You could try the following. Instead of using If directives (which are really intended for checking request parameter, you could try using the IfFile directive.

IfFile checks if a file exists at startup. It has no else option, so you will need to make sure your file checks are exclusive for each server.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda